<template>
  <div>
    <the-header></the-header>
    <the-aside></the-aside>

    <div class="content-box" >
      <v-tags></v-tags>
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
  import TheHeader from '../components/TheAside';
  import TheAside from '../components/TheHeader';
  import vTags from "../components/common/Tags.vue";
  import bus from "../components/common/bus";
  export default {
    components:{
      TheHeader,
      TheAside,
      vTags
    },
    data(){
      return {
        // collapse: false

        collapse: false,
        isIndex: false,
      }
    },
    created(){
      //通过Bus进行组件间的通信，来折叠侧边栏
      bus.$on("collapse", (msg) => {
        this.collapse = msg;
      });
      bus.$on("isIndex", (msg) => {
        this.isIndex = msg;
      });
      // 只有在标签页列表里的页面才使用keep-alive，即关闭标签之后就不保存到内存中了。
      bus.$on("tags", (msg) => {
        let arr = [];
        for (let i = 0, len = msg.length; i < len; i++) {
          msg[i].name && arr.push(msg[i].name);
        }

      });
    }
  }
</script>
